package com.jinlia.show.modules.wxapp.controller;

/**
 * 手机短信
 */

import com.jinlia.show.common.core.utils.UserInfoUtils;
import com.jinlia.show.modules.base.system.service.PhoneMsgMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/phone/mgs")
public class PhoneMsgController {
    @Autowired
    PhoneMsgMapperService phoneMsgMapperService;

    @GetMapping("{phoneNum}")
    public String getPhoneCode(@PathVariable("phoneNum") String phoneNum) {
        return phoneMsgMapperService.sendVerifyCode(phoneNum, UserInfoUtils.getUserId().toString());
    }

    @GetMapping("{phoneNum}/{code}")
    public Boolean checkVerifyCode(@PathVariable("phoneNum") String phoneNum, @PathVariable("code") String code) {
        return phoneMsgMapperService.checkVerifyCode(phoneNum, UserInfoUtils.getUserId().toString(), code);
    }
}
